﻿using AIO.Entity;
using AIO.Entity.Base;
using AIO.IService;
using AIO.Service.Base;

namespace AIO.Service
{
    /// <summary>
    /// 年级-仓库
    /// </summary>
    public class DepartmentRepository :BaseRepository<Department>,IDepartmentRepository
    {
        protected ApiDBContext _Context { get; set; }
        public DepartmentRepository(ApiDBContext context):base(context) 
        {
            _Context= context??throw new ArgumentNullException(nameof(context));
        }
        /// <summary>
        /// 获取数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Department? Get(Guid id)
        {
            return _Context.Department.FirstOrDefault(S => S.Id == id);
        }
        /// <summary>
        /// 获取数据
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public Department? Get(string name)
        {
            return _Context.Department.FirstOrDefault(S => S.Id.ToString() == name);
        }
    }
}
